// house_pkg/pages/room/index.ts
Page({
  onLoad({points,loudong}){
 this.getMoni(points,loudong)
  },
  getMoni(points,loudong){
    const size = Math.floor(Math.random()*5)+4
    const rooms = []
    for (let i = 0; i < size; i++) {
      // 楼层号生成 1 ~ 20
      const floor = Math.floor(Math.random() * 19) + 1
      // 具体的房间号生成 1 ~ 3
      const No = Math.floor(Math.random() * 2) + 1
      const room = [floor, 0, No].join('')
      // 检测是否有重复的房间号
      if (rooms.includes(room)) return
      // 记录生成完整的房间号
      rooms.push(room)
    }
    // 渲染数据
    this.setData({ rooms, points, loudong })
  }
})